// WowNotificationSwitchStrategy.h
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

/*
 - (void)mainSwitchValueChanged:(UISwitch *)sender {
     WowSwitchContext *context = [[[[[[[WowSwitchContextBuilder builder]
         sender:sender]
         manager:self.manager]
         tableViewModel:self.tableViewModel]
         infoModel:self.infoModel]
         viewController:self]
         reloadHandler:^{
             [self.tableView reloadData];
         }] build];
     
     [[WowNotificationSwitchManager sharedManager] handleSwitchWithTag:sender.tag context:context];
 }

 - (void)noticeDuplicationSwitchValueChanged:(UISwitch *)sender {
     WowSwitchContext *context = [[[[[WowSwitchContextBuilder builder]
         sender:sender]
         manager:self.manager]
         tableViewModel:self.tableViewModel]
         viewController:self]
         reloadHandler:^{
             // 不需要刷新整个tableView
         }] build];
     
     [[WowNotificationSwitchManager sharedManager] handleSwitchWithTag:sender.tag context:context];
 }

 // WowNotificationSetPhoneViewController.m
 - (void)mainSwitchValueChanged:(UISwitch *)sender {
     WowSwitchContext *context = [[[[[[[WowSwitchContextBuilder builder]
         sender:sender]
         manager:self.manager]
         infoModel:self.infoModel]
         tableViewModel:self.tableViewModel]
         row:self.row]
         viewController:self]
         reloadHandler:^{
             [self.tableView reloadData];
         }] build];
     
     [[WowNotificationSwitchManager sharedManager] handleSwitchWithTag:sender.tag context:context];
 }

 // WowOtherAppNotificationSetViewController.m
 - (void)switchChanged:(UISwitch *)sender {
     WowSwitchContext *context = [[[[[WowSwitchContextBuilder builder]
         sender:sender]
         manager:self.manager]
         tableViewModel:self.tableViewModel]
         viewController:self]
         reloadHandler:^{
             // 第三方应用有自己的刷新逻辑
         }] build];
     
     [[WowNotificationSwitchManager sharedManager] handleSwitchWithTag:sender.tag context:context];
 }
 */

@class WowNotifiSetToDeviceManager;
@class WowAllAppSetInfoModel;
@class WowAllAppSetModel;

typedef NS_ENUM(NSInteger, WowNotificationSwitchTag) {
    WowNotificationSwitchTagMainSync = 110,
    WowNotificationSwitchTagThrottle = 112,
    WowNotificationSwitchTagMute = 113,
    WowNotificationSwitchTagPhone = 120,
    WowNotificationSwitchTagPhoneScreen = 121,
    WowNotificationSwitchTagMessage = 130,
    WowNotificationSwitchTagMessageScreen = 132,
    WowNotificationSwitchTagSchedule = 140,
    WowNotificationSwitchTagScheduleScreen = 142,
    WowNotificationSwitchTagAlarm = 150,
    WowNotificationSwitchTagAlarmScreen = 151
};

// Switch操作上下文
@interface WowSwitchContext : NSObject
@property (nonatomic, strong) UISwitch *sender;
@property (nonatomic, strong) WowNotifiSetToDeviceManager *manager;
@property (nonatomic, strong) WowAllAppSetInfoModel *infoModel;
@property (nonatomic, strong) WowAllAppSetModel *tableViewModel;
@property (nonatomic, assign) NSInteger row;
@property (nonatomic, weak) UIViewController *viewController;
@property (nonatomic, copy) void(^reloadHandler)(void);
@end

// 策略协议
@protocol WowNotificationSwitchStrategy <NSObject>

@required
// 判断是否能处理该tag
- (BOOL)canHandleTag:(WowNotificationSwitchTag)tag;

// 处理switch操作
- (void)handleSwitchWithContext:(WowSwitchContext *)context;

@optional
// 获取策略优先级（数字越小优先级越高）
- (NSInteger)priority;

// 策略描述（用于调试）
- (NSString *)strategyDescription;

@end
